#include "FreeRTOS.h"
#include "task.h"
#include "main.h"
#include "tim.h"
#include "ps2.h"
#include "cmsis_os2.h"
float cnt1= 0;
uint8_t Ps2_Buff[9]={0};


void Remote_Task(void *argument)
{
  /* USER CODE BEGIN Remote_Task */
  /* Infin	PSX_init();ite loop */
//  	PSX_init();


	
  for(;;)
  {
//		cnt1=DWT->CYCCNT;
		
		cnt1++;
		static uint8_t Readflag =0;
		static float time ;
		if(Readflag==0){
		  Readflag=1;
			time=HAL_GetTick();
		}
		if(HAL_GetTick()-time>=20){
			Readflag=0;
		
			psx_write_read(Ps2_Buff);	
			if(Ps2_Buff[0] == 0x01) PS2_ProcessData(Ps2_Buff,&PS2_Buttons);  
				
				
			
     
		}
		
	
//		PS2_ProcessData(Ps2_Buff);

		vTaskDelay(1);
		
  }
  /* USER CODE END Remote_Task */
}
